'use strict';

const Controller = require('egg').Controller;

class UploadController extends Controller {
  async uploadFiles() {
    const { ctx } = this;
    const data = await ctx.service.upload.index();
    if (data) {
      ctx.body = {
        code: 0,
        message: '上传成功',
        data,
      };
    } else {
      ctx.body = {
        code: 1,
        message: '上传失败',
        data: null,
      };
    }
  }
}

module.exports = UploadController;
